<?php include 'header-inc.php'; ?>

    <div id="inner-wrap">
        <div id="sidebar">
<?php include 'sidebar-inc.php'; ?>

        </div>
        <div id="content-box">
            <div class="inner-box">
                <div class="cmd">
                    <ul>
                        <li><a href="<?php echo $this->_url('user', 'add', array(array(FLEA::getAppInf( 'columnAccessor' )=>$_GET[FLEA::getAppInf( 'columnAccessor' )]))); ?>">新增用户</a></li>
                    </ul>
                </div>
                <div class="pdbox box">
                    <table>
                        <tr>
                            <th width="5%">编号</th>
                            <th width="20%">用户名</th>
                            <th width="20%">用户组</th>
                            <th width="10%">是否启用</th>
                            <th width="15%">创建日期</th>
                            <th width="25%">管理操作</th>
                        </tr>
                        <?php 
                        $islocked = array(
                            0=>'启用',
                            1=>'停用',
                        );
                        ?>
                        <?php if($data['rows']): ?>
                        <?php foreach($data['rows'] as $row): ?>
                        <tr>
                            <td class="tc"><?php echo $row['user_id']; ?></td>
                            <td class="tc"><a href="<?php echo $this->_url('user', 'edit', array(array(FLEA::getAppInf( 'columnAccessor' )=>$_GET[FLEA::getAppInf( 'columnAccessor' )]), array('userid'=>$row['user_id']))); ?>"><?php echo $row['username']; ?></a></td>
                            <td class="tc"><a href="<?php echo $this->_url('user', null, array(array(FLEA::getAppInf( 'columnAccessor' )=>$_GET[FLEA::getAppInf( 'columnAccessor' )]), array('groupid'=>$row['group']['group_id']))); ?>"><?php echo $row['group']['name']; ?></a></td>
                            <td class="tc"><?php echo $islocked[$row['islocked']]; ?></td>
                            <td class="tc"><?php echo date('Y-m-d', $row['created']); ?></td>
                            <td class="tc"><a href="<?php echo $this->_url('user', 'edit', array(array(FLEA::getAppInf( 'columnAccessor' )=>$_GET[FLEA::getAppInf( 'columnAccessor' )]), array('userid'=>$row['user_id']))); ?>">编辑</a> | <a href="#" onclick="remove(<?php echo $row['user_id']; ?>)">删除</a></td>
                        </tr>
                        <?php endforeach; ?>
                        <?php endif; ?>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
<!--
    // 删除内容时显示提示信息
    function remove(id) {
        if(id!=1) {
            var removeUrl = '<?php echo $this->_url($_GET[FLEA::getAppInf( 'controllerAccessor' )], 'remove', array(array(FLEA::getAppInf( 'columnAccessor' ) => $_colkey))); ?>';
            if(confirm("您是要删除这项内容吗?")) {
                document.location = removeUrl + '&userid=' + id;
                return true;
            }
            return false;
        } else {
            alert('该用户为默认管理员用户，无法删除！');
        }
    }
//-->
</script>
</body>
</html>